load("@rules_java//java:defs.bzl", "java_library")

package(
    default_applicable_licenses = ["//:license"],
    default_visibility = [
        "//policy:__pkg__",
        "//publish:__pkg__",
    ],
)

java_library(
    name = "policy",
    srcs = [
        "CelPolicy.java",
    ],
    tags = [
    ],
    deps = [
        ":required_fields_checker",
        ":source",
        "//:auto_value",
        "//common/formats:value_string",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "source",
    srcs = [
        "CelPolicySource.java",
    ],
    tags = [
    ],
    deps = [
        "//:auto_value",
        "//common:source",
        "//common:source_location",
        "//common/internal",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "validation_exception",
    srcs = [
        "CelPolicyValidationException.java",
    ],
    tags = [
    ],
)

java_library(
    name = "parser_factory",
    srcs = ["CelPolicyParserFactory.java"],
    tags = [
    ],
    deps = [
        ":parser_builder",
        ":yaml_parser",
        "@maven//:org_yaml_snakeyaml",
    ],
)

java_library(
    name = "yaml_parser",
    srcs = [
        "CelPolicyYamlParser.java",
    ],
    deps = [
        ":parser",
        ":parser_builder",
        ":policy",
        ":policy_parser_context",
        ":source",
        ":validation_exception",
        "//common:compiler_common",
        "//common/formats:parser_context",
        "//common/formats:value_string",
        "//common/formats:yaml_helper",
        "//common/formats:yaml_parser_context_impl",
        "//common/internal",
        "@maven//:com_google_guava_guava",
        "@maven//:org_yaml_snakeyaml",
    ],
)

java_library(
    name = "parser",
    srcs = [
        "CelPolicyParser.java",
    ],
    tags = [
    ],
    deps = [
        ":policy",
        ":policy_parser_context",
        ":validation_exception",
    ],
)

java_library(
    name = "parser_builder",
    srcs = [
        "CelPolicyParserBuilder.java",
    ],
    tags = [
    ],
    deps = [
        ":parser",
        "@maven//:com_google_errorprone_error_prone_annotations",
    ],
)

java_library(
    name = "compiler",
    srcs = [
        "CelPolicyCompiler.java",
    ],
    tags = [
    ],
    deps = [
        ":compiled_rule",
        ":policy",
        ":validation_exception",
        "//common:cel_ast",
    ],
)

java_library(
    name = "compiler_builder",
    srcs = [
        "CelPolicyCompilerBuilder.java",
    ],
    tags = [
    ],
    deps = [
        ":compiler",
        "@maven//:com_google_errorprone_error_prone_annotations",
    ],
)

java_library(
    name = "compiler_factory",
    srcs = ["CelPolicyCompilerFactory.java"],
    tags = [
    ],
    deps = [
        ":compiler_builder",
        ":compiler_impl",
        "//bundle:cel",
        "//checker:checker_builder",
        "//compiler",
        "//compiler:compiler_builder",
        "//parser:parser_builder",
        "//runtime",
    ],
)

java_library(
    name = "policy_parser_context",
    srcs = [
        "PolicyParserContext.java",
    ],
    tags = [
    ],
    deps = [
        ":policy",
        "//:auto_value",
        "//common/formats:parser_context",
        "//policy:source",
    ],
)

java_library(
    name = "compiled_rule",
    srcs = ["CelCompiledRule.java"],
    deps = [
        "//:auto_value",
        "//bundle:cel",
        "//common:cel_ast",
        "//common:compiler_common",
        "//common/ast",
        "//common/formats:value_string",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "compiler_impl",
    srcs = [
        "CelPolicyCompilerImpl.java",
    ],
    visibility = ["//visibility:private"],
    deps = [
        ":compiled_rule",
        ":compiler",
        ":compiler_builder",
        ":policy",
        ":rule_composer",
        ":source",
        ":validation_exception",
        "//bundle:cel",
        "//common:cel_ast",
        "//common:cel_source",
        "//common:compiler_common",
        "//common:container",
        "//common:source_location",
        "//common/ast",
        "//common/formats:value_string",
        "//common/types",
        "//common/types:type_providers",
        "//optimizer",
        "//optimizer:optimization_exception",
        "//optimizer:optimizer_builder",
        "//validator",
        "//validator:ast_validator",
        "//validator:validator_builder",
        "//validator/validators:ast_depth_limit_validator",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "required_fields_checker",
    srcs = [
        "RequiredFieldsChecker.java",
    ],
    visibility = ["//visibility:private"],
    deps = [
        "//:auto_value",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "rule_composer",
    srcs = ["RuleComposer.java"],
    visibility = ["//visibility:private"],
    deps = [
        ":compiled_rule",
        "//:auto_value",
        "//bundle:cel",
        "//common:cel_ast",
        "//common:compiler_common",
        "//common:mutable_ast",
        "//common/formats:value_string",
        "//extensions:optional_library",
        "//optimizer:ast_optimizer",
        "//optimizer:mutable_ast",
        "//parser:operator",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)
